package com.sz.wu.model;

import java.util.HashMap;
import java.util.Set;

public class UserCar {
    private Integer pscs;//所有商品的总数量
    private Double Sums;//所有商品的总价格
    private HashMap<Integer, UserProduct> map;//储存productCar

    public UserCar() {
    }

    public UserCar(Integer pscs, Double sums, HashMap<Integer, UserProduct> map) {
        this.pscs = pscs;
        Sums = sums;
        this.map = map;
    }

    public Integer getPscs() {
        return pscs;
    }

    public void setPscs(Integer pscs) {
        this.pscs = pscs;
    }

    public Double getSums() {
        return Sums;
    }

    public void setSums(Double sums) {
        Sums = sums;
    }

    public HashMap<Integer, UserProduct> getMap() {
        pscs = 0;
        Sums = 0D;
        Set<Integer> set = map.keySet();
        for (Integer integer : set) {
            pscs += map.get(integer).getPsc();
            Sums += map.get(integer).getSum();
        }
        return map;
    }

    public void setMap(HashMap<Integer, UserProduct> map) {
        this.map = map;
    }
}
